/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.*;

/**
 *
 * @author Shravan
 */
public abstract class Algorithm {

    private String algoName;
    private String companyTicker;
    private double currentStockPrice;
    private double strikePrice;
    private double term;
    private double volatility;
    private double riskFreeRate;
    private HashMap<String, Double> extraParameters = new HashMap<String, Double>();
    private OptionType[] optionTypes;

    public enum OptionType {

        AMERICAN_CALL, AMERICAN_PUT, ASIAN_CALL, ASIAN_PUT, EUROPEAN_CALL, EUROPEAN_PUT
    }

    public Algorithm() {
    }

    public Algorithm(String algoName, OptionType[] optionTypes, double[] extraParametersInput) {
        this.algoName = algoName;
        this.optionTypes = optionTypes;
        initExtraParameters(extraParametersInput);
    }

    public Algorithm(String algoName, String companyTicker, double currentStockPrice, double strikePrice, double term, double volatility, double riskFreeRate, OptionType[] optionTypes, double[] extraParametersInput) {
        this.algoName = algoName;
        this.companyTicker = companyTicker;
        this.currentStockPrice = currentStockPrice;
        this.strikePrice = strikePrice;
        this.term = term;
        this.volatility = volatility;
        this.riskFreeRate = riskFreeRate;
        this.optionTypes = optionTypes;
        initExtraParameters(extraParametersInput);
    }
    
    public abstract void initExtraParameters(double[] extraParametersInput);
    
    public String getAlgoName() {
        return algoName;
    }

    public void setAlgoName(String algoName) {
        this.algoName = algoName;
    }

    public String getCompanyTicker() {
        return companyTicker;
    }

    public void setCompanyTicker(String companyTicker) {
        this.companyTicker = companyTicker;
    }

    public double getCurrentStockPrice() {
        return currentStockPrice;
    }

    public void setCurrentStockPrice(double currentStockPrice) {
        this.currentStockPrice = currentStockPrice;
    }

    public double getStrikePrice() {
        return strikePrice;
    }

    public void setStrikePrice(double strikePrice) {
        this.strikePrice = strikePrice;
    }

    public double getTerm() {
        return term;
    }

    public void setTerm(double term) {
        this.term = term;
    }

    public double getVolatility() {
        return volatility;
    }

    public void setVolatility(double volatility) {
        this.volatility = volatility;
    }

    public double getRiskFreeRate() {
        return riskFreeRate;
    }

    public void setRiskFreeRate(double riskFreeRate) {
        this.riskFreeRate = riskFreeRate;
    }

    public HashMap<String, Double> getExtraParameters() {
        return extraParameters;
    }

    public void setExtraParameters(HashMap<String, Double> extraParameters) {
        this.extraParameters = extraParameters;
    }

    public OptionType[] getOptionTypes() {
        return optionTypes;
    }

    public void setOptionTypes(OptionType[] optionTypes) {
        this.optionTypes = optionTypes;
    }

    public abstract double calculatePutPrice();

    public abstract double calculateCallPrice();

}
